home *** CD-ROM | disk | FTP | other *** search
- unit TreeVuU;
-
- {$ifdef Windows} { Delphi 1.0x }
- 'Win32 only'
- {$endif}
- {$ifdef Ver90} { Delphi 2.0x }
- {$define DelphiLessThan4}
- {$endif}
- {$ifdef Ver93} { C++ Builder 1.0x }
- {$define DelphiLessThan4}
- {$endif}
- {$ifdef Ver100} { Delphi 3.0x }
- {$define DelphiLessThan4}
- {$endif}
- {$ifdef Ver110} { C++ Builder 3.0x }
- {$define DelphiLessThan4}
- {$endif}
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls, ComCtrls;
-
- type
- TForm1 = class(TForm)
- TreeView1: TTreeView;
- CheckBox1: TCheckBox;
- procedure CheckBox1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.CheckBox1Click(Sender: TObject);
- {$ifdef DelphiLessThan4}
- const
- TVS_NOTOOLTIPS = $80;
- var
- Style: Integer;
- begin
- Style := GetWindowLong(TreeView1.Handle, GWL_STYLE);
- //Could use this if you just wanted to toggle states
- //Style := Style xor TVS_NOTOOLTIPS;
- if CheckBox1.Checked then
- Style := Style and not TVS_NOTOOLTIPS
- else
- Style := Style or TVS_NOTOOLTIPS;
- SetWindowLong(TreeView1.Handle, GWL_STYLE, Style);
- end;
- {$else}
- begin
- TreeView1.Tooltips := CheckBox1.Checked
- end;
- {$endif}
-
- end.
-